
// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "chat_admin.h"

#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

// CMainFrame

IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)

	BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
		ON_WM_CREATE()
		//ON_WM_PAINT()
		//ON_WM_SIZE()
		ON_WM_CLOSE()
		ON_MESSAGE(WM_NOTIFICATION, &CMainFrame::OnNotification)
	END_MESSAGE_MAP()

	static UINT indicators[] =
	{
		ID_SEPARATOR,           // status line indicator
		ID_INDICATOR_CAPS,
		ID_INDICATOR_NUM,
		ID_INDICATOR_SCRL,
	};

	// CMainFrame construction/destruction

	CMainFrame::CMainFrame()
	{
		// TODO: add member initialization code here
	}

	CMainFrame::~CMainFrame()
	{
	}

	void CMainFrame::OnSize(UINT nType, int cx, int cy)
	{

		//HDC hdc=::GetDC(NULL);
		//int wight=GetDeviceCaps(hdc,HORZRES);
		//int hight=GetDeviceCaps(hdc,VERTRES);
		//RECT rect={0,0,wight,hight};
		//OnPaint();
		//RedrawWindow(&rect);
		//UpdateWindow();
	}
	int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
	{


		//lpCreateStruct->dwExStyle^=WS_EX_TOPMOST;
		//lpCreateStruct->lpszClass=L"TOAD";
		if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
			return -1;

		if (!m_wndStatusBar.Create(this))
		{
			TRACE0("Failed to create status bar\n");
			return -1;      // fail to create
		}
		m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));

		return 0;
	}

	BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
	{
		//   AfxMessageBox(	 cs.lpszClass);
		//AfxMessageBox(	 cs.lpszName);
		//cs.lpszClass=L"ChatAdmin";
		//cs.lpszName=L"ChatAdmin";
		//cs.lpszClass=L"TOAD";
		if( !CMDIFrameWnd::PreCreateWindow(cs) )
			return FALSE;
		// TODO: Modify the Window class or styles here by modifying
		//  the CREATESTRUCT cs

		cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE
			| WS_THICKFRAME   | WS_MAXIMIZE|WS_MAXIMIZEBOX | WS_SYSMENU;
		//cs.style = WS_CAPTION | FWS_ADDTOTITLE
		// | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE | WS_SYSMENU;

		return TRUE;
	}

	// CMainFrame diagnostics

#ifdef _DEBUG
	void CMainFrame::AssertValid() const
	{
		CMDIFrameWnd::AssertValid();
	}

	void CMainFrame::Dump(CDumpContext& dc) const
	{
		CMDIFrameWnd::Dump(dc);
	}
#endif //_DEBUG


	// CMainFrame message handlers



	void CMainFrame::OnClose()
	{

		// TODO: Add your message handler code here and/or call default
		//NOTIFYICONDATAW notify={0};
		//notify.cbSize         = sizeof(notify);
		//notify.hWnd=m_hWnd;
		//notify.uID            = 100;      // Per WinCE SDK docs, values from 0 to 12 are reserved and should not be used.
		//notify.uFlags         = NIF_ICON|NIF_MESSAGE|NIF_TIP;
		//lstrcpy(notify.szTip,L"hi notify");
		//notify.uCallbackMessage=WM_NOTIFICATION;
		//notify.hIcon=LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME));

		//Shell_NotifyIcon(NIM_ADD,&notify);
		//ShowWindow(SW_HIDE);
		//SendMessge(m_hWnd,WM_);
		CMDIFrameWnd::OnClose();
	}


	BOOL CMainFrame::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
	{
		// TODO: Add your specialized code here and/or call the base class

		ShowWindow(SW_NORMAL);
		return CMDIFrameWnd::OnNotify(wParam, lParam, pResult);
	}


	afx_msg LRESULT CMainFrame::OnNotification(WPARAM wParam, LPARAM lParam)
	{			  
		ShowWindow(SW_NORMAL);
		return 0;
	}
